home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / mdispn.doc < prev    next >
Text File  |  1995-03-31  |  21KB  |  490 lines

  1.    From: Rick Grevelle <hpcvra!ftg0673%tamsun.tamu.edu> 
  2. Subject: MDISPN 
  3.    Date: Tue, 16 Jun 92 
  4.  
  5. [Mini-instructions: String on level 2, real number on level 1. 
  6.  (Original used system binary; I changed it).  Basically same as DISP 
  7.  except it's twice as fast, and MDISPN doesn't do newlines.  -jkh-] 
  8.  
  9. Just recently I learned that on the average there was a 30% speed 
  10. penalty in run time due to the page switching in the 48.  According 
  11. to Jake Schwartz it was Hewlett-Packard's Dennis York who alluded 
  12. to this during the 1992 Handheld User's Conference in Philadelphia. 
  13.  
  14. After the experience gained from developing the machine language 
  15. library builder, I began looking for ways to greatly increase its 
  16. performance along with other previously written programs.  It'll 
  17. probably come as no surprise, but I fully expect USRLB for the 48 
  18. to build some libraries 10 times faster than's now possible.  In 
  19. similar fashion MDISP has been rewritten, and the speed gained is 
  20. quite enough to make mention of it.  While the routine itself is 
  21. not very large, and could be even shorter at the expense of speed 
  22. which is usually the case, it's the font table that accounts for 
  23. the majority of the bytes; 2040 to be exact.  The main advantages 
  24. are of course the speed gained from not having to bank shift the 
  25. machine each time the font table is accessed, and the flexibility 
  26. to create or modify existing fonts.  In this current version the 
  27. first 32 fonts not included in the 48's table have been added and 
  28. were modeled after the ANSI standard used by MS-DOS.  Anyone who 
  29. plans to write and market software for the 48 should consider the 
  30. advantage of using a customized display routine for applications 
  31. requiring a great deal of displaying. 
  32.  
  33. As is evident from the source code, MDISPN can be easily modified from 
  34. its present form to meet a variety of needs, and as previously stated it 
  35. can just as easily be made shorter, but at the sacrifice of speed.  In 
  36. most cases this particular font size is prefered which is why it's shown 
  37. here, but similar schemes can be written utilizing either the smallest 
  38. or largest fonts.  Also of interest is the additional ability to control 
  39. the menu label area of the display; MDISPN has an 8 level understanding 
  40. of the display while DISPN has 7, and could be quite helpful for browser 
  41. formats using the complete screen.  The source code is straight forward: 
  42.  
  43.  
  44. ************************************************************************* 
  45. ** 
  46. ** Name: MDISPN 
  47. ** 
  48. ** Calls: SavPtr, GetPtr. 
  49. ** 
  50. ** Entry: D1[A]: XXXXX = address of level 1 system binary; level 2 string. 
  51. ** 
  52. ** Exit: D1[A]: XXXXX+10 = address of level three object. 
  53. ** 
  54. ** Trashes Registers: A[W], B[A], C[A], D0[A], D1[A], and ST[0,1]. 
  55. ** 
  56. ** Stack Levels: 2 
  57. ** 
  58. ** Purpose: 
  59. ** 
  60. ** Displays level 2 string in one of 8 display levels as specified by the 
  61. ** level 1 system binary, where ONE is the top most level of the display, 
  62. ** and EIGHT is the bottom of the display usually occupied by menu labels. 
  63. ** 
  64. ************************************************************************* 
  65. DoCode    EQU       #02DCC 
  66. SavPtr    EQU       #0679B 
  67. GetPtr    EQU       #05143 
  68.  
  69.           NIBASC    \HPHP48-E\                   object header 
  70.           CON(5)    DoCode                       begin code 
  71.           REL(5)    EndMDSP 
  72.           C=DAT1    A                            c=hhhhh 
  73.           CD1EX                                  d1=(above), c=XXXXX 
  74.           D1=D1+    5                            d1=hhhhh+5 
  75.           A=DAT1    A                            a=row number 
  76.           D1=C                                   d1=XXXXX 
  77.           D1=D1+    5                            drops 
  78.           D=D+1     A                            level 1 
  79.           C=DAT1    A                            c=iiiii 
  80.           RSTK=C                                 address saved string 
  81.           D1=D1+    5                            drops 
  82.           D=D+1     A                            level 2 
  83.           GOSBVL    SavPtr                       save registers 
  84.           C=0       A 
  85.           A=A-1     A 
  86.           GOC       Row1 
  87.           A=A-1     A 
  88.           GOC       Row1 
  89.           A=A-1     A 
  90.           GOC       Row2 
  91.           A=A-1     A 
  92.           GOC       Row3 
  93.           A=A-1     A 
  94.           GOC       Row4 
  95.           A=A-1     A 
  96.           GOC       Row5 
  97.           A=A-1     A 
  98.           GOC       Row6 
  99.           A=A-1     A 
  100.           GOC       Row7 
  101.           LCHEX     14 
  102.           D1=HEX    70551                        address menu GROB cache 
  103.           GONC      PstStRw 
  104.  
  105. Row1      LCHEX     14 
  106.           GOC       SetRowN 
  107.  
  108. Row2      LCHEX     124 
  109.           GOC       SetRowN 
  110.  
  111. Row3      LCHEX     234 
  112.           GOC       SetRowN 
  113.  
  114. Row4      LCHEX     344 
  115.           GOC       SetRowN 
  116.  
  117. Row5      LCHEX     454 
  118.           GOC       SetRowN 
  119.  
  120. Row6      LCHEX     564 
  121.           GOC       SetRowN 
  122.  
  123. Row7      LCHEX     674 
  124.  
  125. SetRowN   D1=HEX    7055B                        d1=7055B 
  126.  
  127. PstStRw   A=DAT1    A                            a=display write address 
  128.           C=C+A     A                            c=display address 
  129.           RSTK=C                                 saved display address 
  130.           D1=C      A                            d1=(above) 
  131.           LCHEX     10                           initialize loop count 
  132.           A=0       W 
  133.  
  134. ClrLoop   DAT1=A    W                            clear pixels 
  135.           D1=D1+    16                           d1=address next pixels 
  136.           C=C-1     B                            decrement loop counter 
  137.           GONC      ClrLoop 
  138.           C=RSTK                                 c=display address 
  139.           D1=C                                   d1 restored 
  140.           C=RSTK                                 c=iiiii 
  141.           D0=C                                   d0=(above) 
  142.           D0=D0+    5                            d0=iiiii+5 
  143.           C=DAT0    A                            c=string length 
  144.           C=C-CON   A,5                          c=nibbles 
  145.           CSRB.F    A                            c=bytes 
  146.           D0=D0+    3                            d0=address 1st character-2 
  147.           B=C       A                            b=bytes 
  148.           ST=0      0                            clear even pass detect bit 
  149.           ST=0      1                            clear over size detect bit 
  150.           LCHEX     00016                        c=00016 
  151.           ?B<=C     A 
  152.           GOYES     FontTbl 
  153.           ST=1      1                            set over size detect bit 
  154.           B=C       A                            b=00016 
  155.           B=B-1     A                            b=00015 
  156.  
  157. FontTbl   GOSUBL    ChrLoop 
  158.           NIBHEX    0000000000515100 
  159.           NIBHEX    E011B111F15111E0 
  160.           NIBHEX    E0F151F111B1F1E0 
  161.           NIBHEX    A0F1F1F1E0400000 
  162.           NIBHEX    0040E0F1E0400000 
  163.           NIBHEX    40E0B1B1E040E000 
  164.           NIBHEX    40E0F1F1E040E000 
  165.           NIBHEX    000040E040000000 
  166.           NIBHEX    F1F1B111B1F1F100 
  167.           NIBHEX    000040A040000000 
  168.           NIBHEX    F1F1B151B1F1F100 
  169.           NIBHEX    C18141E01111E000 
  170.           NIBHEX    E01111E040E04000 
  171.           NIBHEX    60A0202020201000 
  172.           NIBHEX    E121E12121A01000 
  173.           NIBHEX    4051E0B1E0514000 
  174.           NIBHEX    103070F170301000 
  175.           NIBHEX    0181C1F1C1810100 
  176.           NIBHEX    40E04040E0400000 
  177.           NIBHEX    2121212121002100 
  178.           NIBHEX    E151516141414100 
  179.           NIBHEX    C120C021C001E000 
  180.           NIBHEX    000000F1F1000000 
  181.           NIBHEX    40E04040E040E000 
  182.           NIBHEX    40E0404040404000 
  183.           NIBHEX    4040404040E04000 
  184.           NIBHEX    004080F180400000 
  185.           NIBHEX    004020F120400000 
  186.           NIBHEX    00001010F1000000 
  187.           NIBHEX    0000A0F1A0000000 
  188.           NIBHEX    000040E0F1F10000 
  189.           NIBHEX    0000F1F1E0400000 
  190.           NIBHEX    0000000000000000 
  191.           NIBHEX    4040404040004000 
  192.           NIBHEX    A0A0A00000000000 
  193.           NIBHEX    A0A0F1A0F1A0A000 
  194.           NIBHEX    40E150E041F04000 
  195.           NIBHEX    3031804020918100 
  196.           NIBHEX    2050502051906100 
  197.           NIBHEX    4040400000000000 
  198.           NIBHEX    8040202020408000 
  199.           NIBHEX    2040808080402000 
  200.           NIBHEX    00A040F140A00000 
  201.           NIBHEX    004040F140400000 
  202.           NIBHEX    0000000060604020 
  203.           NIBHEX    000000F100000000 
  204.           NIBHEX    0000000000606000 
  205.           NIBHEX    0001804020100000 
  206.           NIBHEX    E01191513111E000 
  207.           NIBHEX    406040404040E000 
  208.           NIBHEX    E01101C02010F100 
  209.           NIBHEX    E01101E00111E000 
  210.           NIBHEX    80C0A090F1808000 
  211.           NIBHEX    F110F0010111E000 
  212.           NIBHEX    C02010F01111E000 
  213.           NIBHEX    F101804020202000 
  214.           NIBHEX    E01111E01111E000 
  215.           NIBHEX    E01111E101806000 
  216.           NIBHEX    0060600060600000 
  217.           NIBHEX    0060600060604020 
  218.           NIBHEX    8040201020408000 
  219.           NIBHEX    0000F100F1000000 
  220.           NIBHEX    1020408040201000 
  221.           NIBHEX    E011018040004000 
  222.           NIBHEX    E01151D15010E100 
  223.           NIBHEX    E01111F111111100 
  224.           NIBHEX    F01111F01111F000 
  225.           NIBHEX    E01110101011E000 
  226.           NIBHEX    7090111111907000 
  227.           NIBHEX    F11010F01010F100 
  228.           NIBHEX    F11010F010101000 
  229.           NIBHEX    E01110109111E100 
  230.           NIBHEX    111111F111111100 
  231.           NIBHEX    E04040404040E000 
  232.           NIBHEX    010101011111E000 
  233.           NIBHEX    1190503050901100 
  234.           NIBHEX    101010101010F100 
  235.           NIBHEX    11B1515111111100 
  236.           NIBHEX    1111315191111100 
  237.           NIBHEX    E01111111111E000 
  238.           NIBHEX    F01111F010101000 
  239.           NIBHEX    E011111151906100 
  240.           NIBHEX    F01111F050901100 
  241.           NIBHEX    E01110E00111E000 
  242.           NIBHEX    F140404040404000 
  243.           NIBHEX    111111111111E000 
  244.           NIBHEX    111111A0A0404000 
  245.           NIBHEX    1111115151B11100 
  246.           NIBHEX    1111A040A0111100 
  247.           NIBHEX    1111A04040404000 
  248.           NIBHEX    F10180402010F100 
  249.           NIBHEX    E02020202020E000 
  250.           NIBHEX    0010204080010000 
  251.           NIBHEX    E08080808080E000 
  252.           NIBHEX    40A0110000000000 
  253.           NIBHEX    000000000000F100 
  254.           NIBHEX    2020400000000000 
  255.           NIBHEX    0000E001E111E100 
  256.           NIBHEX    1010F0111111F000 
  257.           NIBHEX    0000E1101010E100 
  258.           NIBHEX    0101E1111111E100 
  259.           NIBHEX    0000E011F110E000 
  260.           NIBHEX    40A0207020202000 
  261.           NIBHEX    0000E01111E101E0 
  262.           NIBHEX    1010F01111111100 
  263.           NIBHEX    400060404040E000 
  264.           NIBHEX    8000C08080809060 
  265.           NIBHEX    1010905030509000 
  266.           NIBHEX    604040404040E000 
  267.           NIBHEX    0000B05151511100 
  268.           NIBHEX    0000F01111111100 
  269.           NIBHEX    0000E0111111E000 
  270.           NIBHEX    0000F01111F01010 
  271.           NIBHEX    0000E11111E10101 
  272.           NIBHEX    0000D13010101000 
  273.           NIBHEX    0000E110E001F000 
  274.           NIBHEX    2020702020A04000 
  275.           NIBHEX    000011111111E100 
  276.           NIBHEX    0000111111A04000 
  277.           NIBHEX    000011115151A000 
  278.           NIBHEX    000011A040A01100 
  279.           NIBHEX    0000111111E101E0 
  280.           NIBHEX    0000F1804020F100 
  281.           NIBHEX    C02020102020C000 
  282.           NIBHEX    4040404040404000 
  283.           NIBHEX    6080800180806000 
  284.           NIBHEX    0000205180000000 
  285.           NIBHEX    51A051A051A05100 
  286.           NIBHEX    000180406090F100 
  287.           NIBHEX    F10011A040A01100 
  288.           NIBHEX    00F111A0A0400000 
  289.           NIBHEX    C140404050604000 
  290.           NIBHEX    8041404040502000 
  291.           NIBHEX    F12140804021F100 
  292.           NIBHEX    3070F0F1F0703000 
  293.           NIBHEX    0000F1A0A0A0A000 
  294.           NIBHEX    204080E11111E000 
  295.           NIBHEX    01804020F100F100 
  296.           NIBHEX    10204080F100F100 
  297.           NIBHEX    0080F140F1200000 
  298.           NIBHEX    0000006190906100 
  299.           NIBHEX    004080F180400000 
  300.           NIBHEX    004020F120400000 
  301.           NIBHEX    4040404051E04000 
  302.           NIBHEX    40E0514040404000 
  303.           NIBHEX    0000215180808000 
  304.           NIBHEX    402040E090906000 
  305.           NIBHEX    0000E010F010E000 
  306.           NIBHEX    0000A05141410101 
  307.           NIBHEX    609090F090906000 
  308.           NIBHEX    0010102040A01100 
  309.           NIBHEX    00C02121E0202010 
  310.           NIBHEX    0000E19090906000 
  311.           NIBHEX    0000E15040418000 
  312.           NIBHEX    000090115151A000 
  313.           NIBHEX    000040A011F10000 
  314.           NIBHEX    F1A0A0A0A0A0A000 
  315.           NIBHEX    E011111111A0B100 
  316.           NIBHEX    0000E0E0E0000000 
  317.           NIBHEX    0000A05151A00000 
  318.           NIBHEX    0000000000000000 
  319.           NIBHEX    4000404040404000 
  320.           NIBHEX    0040E15050E14000 
  321.           NIBHEX    C02120702020F100 
  322.           NIBHEX    11E0111111E01100 
  323.           NIBHEX    1111A0F140F14000 
  324.           NIBHEX    4040400040404000 
  325.           NIBHEX    C020E011E0806000 
  326.           NIBHEX    A000000000000000 
  327.           NIBHEX    E01171317111E000 
  328.           NIBHEX    6080E09060F00000 
  329.           NIBHEX    0041A050A0410000 
  330.           NIBHEX    000000F080000000 
  331.           NIBHEX    000000F000000000 
  332.           NIBHEX    E0117171B111E000 
  333.           NIBHEX    F100000000000000 
  334.           NIBHEX    E0A0E00000000000 
  335.           NIBHEX    004040F14040F100 
  336.           NIBHEX    E080E020E0000000 
  337.           NIBHEX    E080E080E0000000 
  338.           NIBHEX    8040000000000000 
  339.           NIBHEX    0000009090907110 
  340.           NIBHEX    E171716141416100 
  341.           NIBHEX    0000006060000000 
  342.           NIBHEX    0000000000408060 
  343.           NIBHEX    604040E000000000 
  344.           NIBHEX    E01111E000F10000 
  345.           NIBHEX    0050A041A0500000 
  346.           NIBHEX    1090502051C10100 
  347.           NIBHEX    109050A111808100 
  348.           NIBHEX    3021B06071C10100 
  349.           NIBHEX    400040201011E000 
  350.           NIBHEX    2040E011F1111100 
  351.           NIBHEX    8040E011F1111100 
  352.           NIBHEX    40A0E011F1111100 
  353.           NIBHEX    A050E011F1111100 
  354.           NIBHEX    A000E011F1111100 
  355.           NIBHEX    E0A0E011F1111100 
  356.           NIBHEX    A15050F15050D100 
  357.           NIBHEX    E011101011E08060 
  358.           NIBHEX    2040F110F010F100 
  359.           NIBHEX    8040F110F010F100 
  360.           NIBHEX    40A0F110F010F100 
  361.           NIBHEX    A000F110F010F100 
  362.           NIBHEX    2040E0404040E000 
  363.           NIBHEX    8040E0404040E000 
  364.           NIBHEX    40A0E0404040E000 
  365.           NIBHEX    A000E0404040E000 
  366.           NIBHEX    60A0217121A06000 
  367.           NIBHEX    41A0113151911100 
  368.           NIBHEX    2040E0111111E000 
  369.           NIBHEX    8040E0111111E000 
  370.           NIBHEX    40A0E0111111E000 
  371.           NIBHEX    A050E0111111E000 
  372.           NIBHEX    A000E0111111E000 
  373.           NIBHEX    0011A040A0110000 
  374.           NIBHEX    01E0915131E01000 
  375.           NIBHEX    204011111111E000 
  376.           NIBHEX    804011111111E000 
  377.           NIBHEX    40A000111111E000 
  378.           NIBHEX    A00011111111E000 
  379.           NIBHEX    804011A040404000 
  380.           NIBHEX    7020E021E0207000 
  381.           NIBHEX    E011F01111F01010 
  382.           NIBHEX    2040E001E111E100 
  383.           NIBHEX    8040E001E111E100 
  384.           NIBHEX    40A0E001E111E100 
  385.           NIBHEX    A050E001E111E100 
  386.           NIBHEX    A000E001E111E100 
  387.           NIBHEX    E0A0E001E111E100 
  388.           NIBHEX    0000B141F150F100 
  389.           NIBHEX    0000E11010E18060 
  390.           NIBHEX    2040E011F110E000 
  391.           NIBHEX    8040E011F110E000 
  392.           NIBHEX    40A0E011F110E000 
  393.           NIBHEX    A000E011F110E000 
  394.           NIBHEX    204000604040E000 
  395.           NIBHEX    804000604040E000 
  396.           NIBHEX    40A000604040E000 
  397.           NIBHEX    A00000604040E000 
  398.           NIBHEX    80C180E090906000 
  399.           NIBHEX    41A000F011111100 
  400.           NIBHEX    204000E01111E000 
  401.           NIBHEX    804000E01111E000 
  402.           NIBHEX    40A000E01111E000 
  403.           NIBHEX    41A000E01111E000 
  404.           NIBHEX    A00000E01111E000 
  405.           NIBHEX    004000F100400000 
  406.           NIBHEX    000061905121D000 
  407.           NIBHEX    204000111111E100 
  408.           NIBHEX    804000111111E100 
  409.           NIBHEX    40A000111111E100 
  410.           NIBHEX    A00000111111E100 
  411.           NIBHEX    8040001111E101E0 
  412.           NIBHEX    0010709090701010 
  413.           NIBHEX    A000001111E101E0 
  414.  
  415. ChrLoop   C=RSTK                                 c=address 1st font 
  416.           B=B-1     A                            decrement character count 
  417.           GOC       OvrSzTs 
  418.           RSTK=C                                  
  419.           D0=D0+    2                            d0=address next character 
  420.           A=0       A                            a=00000 
  421.           A=DAT0    B                            a=000(ascii character) 
  422.           ASL       A                            a=(above)x16 
  423.           C=C+A     A                            c=address character's font 
  424.           CD0EX                                  c=address current character 
  425.           RSTK=C                                 rstk=(above) 
  426.           P=        8                            initialize pixel loop count 
  427.           ?ST=1     0 
  428.           GOYES     EvnLoop 
  429.  
  430. OddLoop   C=DAT0    B                            c=byte from font table 
  431.           DAT1=C    B                            set pixel row 
  432.           D1=D1+    16                           \ 
  433.           D1=D1+    16                            d1=next pixel row 
  434.           D1=D1+    2                            / 
  435.           D0=D0+    2                            d0=address next byte 
  436.           P=P+1                                  decrement loop count 
  437.           GONC      OddLoop 
  438.           ST=1      0                            set even pass detect bit 
  439.           AD1EX 
  440.           LCHEX     0010F 
  441.           A=A-C     A 
  442.           D1=A 
  443.           C=RSTK                                 c=address current character 
  444.           D0=C                                   d0=(above) 
  445.           GOTO      ChrLoop 
  446.  
  447. OvrSzTs   ?ST=1     1 
  448.           GOYES     DoTics 
  449.           GOVLNG    GetPtr 
  450.  
  451. DoTics    D0=C                                   d0=address tic font 
  452.           P=        8                            initialize pixel loop count 
  453.  
  454. TicLoop   C=DAT0    B                            c=byte from font table 
  455.           CSL       A                            \ 
  456.           CSRB.F    A                             move pixels 2 columns left 
  457.           CSRB.F    A                            / 
  458.           A=DAT1    B 
  459.           C=C!A     B                            add previous pixels 
  460.           DAT1=C    B                            set pixel row 
  461.           D1=D1+    16                           \ 
  462.           D1=D1+    16                            d1=next pixel row 
  463.           D1=D1+    2                            / 
  464.           D0=D0+    2                            d0=address next byte 
  465.           P=P+1                                  decrement loop count 
  466.           GONC      TicLoop 
  467.           GOVLNG    GetPtr 
  468.  
  469. EvnLoop   C=DAT0    B                            c=byte from font table 
  470.           CSL       A                            \ 
  471.           CSRB.F    A                             move pixels 2 columns left 
  472.           CSRB.F    A                            / 
  473.           A=DAT1    B 
  474.           C=C!A     B                            add previous pixels 
  475.           DAT1=C    B                            set pixel row 
  476.           D1=D1+    16                           \ 
  477.           D1=D1+    16                            d1=next pixel row 
  478.           D1=D1+    2                            / 
  479.           D0=D0+    2                            d0=address next byte 
  480.           P=P+1                                  decrement loop count 
  481.           GONC      EvnLoop 
  482.           ST=0      0                            set even pass detect bit 
  483.           AD1EX 
  484.           LCHEX     0010E 
  485.           A=A-C     A 
  486.           D1=A 
  487.           C=RSTK                                 c=address current character 
  488.           D0=C                                   d0=(above) 
  489.           GOTO      ChrLoop 
  490.